package com.tarena.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.smartstruts.action.Action;
import org.smartstruts.action.ActionForm;

import com.tarena.bo.EmpDao;
import com.tarena.util.StrToInt;

/**
 * 删除员工
 * 
 * @author Wangpeihu
 * @since 05/01/2010
 * @Team [Never give up]
 */
public class DeleteEmpAction extends Action {

	private EmpDao ed = new EmpDao();

	@Override
	public String execute(ActionForm form, HttpServletRequest request,
			HttpServletResponse response) {
		try {
			String[] empId = request.getParameterValues("empId");
			if (empId != null && empId.length > 0) {
				int[] empIdInt = StrToInt.toInt(empId);
				ed.deleteEmp(empIdInt);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return "success";
	}

}
